package com.dell.chen.dao.impl;

import com.dell.chen.dao.OrderDao;
import com.dell.chen.pojo.Order;

import java.util.List;

/**
 * @author ：ChenwithIU
 * @date ：Created in 2020/12/7 15:27
 */
public class OrderDaoImpl extends BaseDao implements OrderDao {
    @Override
    public int saveOrder(Order order) {
        String sql = "insert into f_order(`ordernum`,`f_name`,`count`,`totalprice`,`username`,`create_time`,`status`) values(?,?,?,?,?,?,?)";

        return update(sql,order.getOrderNum(),order.getF_name(),order.getCount(),order.getTotalPrice(),order.getUsername(),order.getCreate_time(),order.getStatus());
    }

    @Override
    public List<Order> queryOrderByUsername(String username) {
        String sql = "select `ordernum`,`f_name`,`count`,`totalprice`,`username`,`create_time`,`status` from f_order  where username=?";
        return queryForList(Order.class,sql,username);
    }
}
